package day05;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class HomeWork {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random r = new Random();
        int score = 0;
        for (int k = 1; k <= 10; k++) {
            int i = r.nextInt(100)+1;
            int j = r.nextInt(100)+1;
            System.out.println("("+k+")"+i+"+"+j+"=");
            int sum = sc.nextInt();
            if (sum ==i+j){
                System.out.println("恭喜，回答正确！");
                score++;
            }else {
                System.out.println("可惜了，回答错误。。。");
            }
        }
        System.out.println("您本轮的总分数为："+score);

        for (int i = 1; i <10; i++) {
            for (int j = 1; j <=i ; j++) {
                System.out.print(j+"*"+i+"="+j*i+"\t");
            }
            System.out.println();
        }

        int[] arr ={1,50,90,44,56,34,40};
        int[] arr1 = new int[5];
        arr1[0] = 50;
        System.out.println(arr1[0]);
        System.out.println(arr[1]);

        int max = 0;
        for (int k : arr) {
            System.out.print(k + " ");
            if (max < k) {
                max = k;
            }
        }
        System.out.println();

        System.out.println("最大值："+max);
        Arrays.sort(arr);
        for (int k : arr) {
            System.out.print(k + " ");
        }
        System.out.println();

        int sum = 0;
        for (int i = 1; i <= 100; i++) {
            if (i%2==0){
                sum+=i;
            }
        }
        System.out.println("1-100偶数的总和为："+sum);

        sum =1;
        for (int i = 8; i >0 ; i--) {
            sum*=i;
        }
        System.out.println("8的阶乘为："+sum);

        for (int i = 1; i <= 6; i++) {
            for (int j = 0; j < 2*i-1; j++) {
                System.out.print("*");
            }
            System.out.println();
            
        }

        int[] arr2 =new int[10];
        max = 0;
        for (int i = 0; i < arr2.length ; i++) {
            arr2[i] =r.nextInt(100)+1;
            System.out.print(arr2[i]+" ");
            if (max<arr2[i]){
                max=arr2[i];
            }
        }
        System.out.println();

        int min = arr2[0];
        for (int i = 1; i < arr2.length; i++) {
            if (arr2[i]<min){
                min = arr2[i];
            }
        }
        System.out.println("最大值："+max+"最小值："+min);
    }
}
